#!/usr/bin/perl

##  --------------------------------------------------------
##                       use/require
##  --------------------------------------------------------

use strict;
use warnings;

use File::Basename;

use YubicoClient;


##  --------------------------------------------------------
##                 function  ::  usage
##  --------------------------------------------------------
##
##  sig  ::  (void|errMsg:str)  --->  void

sub usage(;$)
{
  print "\n\n!!!  @_\n\n" if @_;
  my $prog = basename $0;

  print <<_USAGE_END;

Usage:
    $prog  clientID  oneTimePasscode

_USAGE_END
}


##  --------------------------------------------------------
##                      main program
##  --------------------------------------------------------

##  Perl interpreter version used: 5.8.8

if (@ARGV != 2) { usage and exit 2 }
my $yubicoClient = YubicoClient->new();
$yubicoClient->clientId($ARGV[0]);
if ($yubicoClient->verify($ARGV[1])) { print "OTP verification ok\n" }
else { print "OTP verification failed\n" }
